# a CMake module for Pylon library
# created 05/11/14
# author: Shawn Le



# ######### Look for Pylon library headers
find_path(PYLON_INCLUDE_DIR 
					NAMES 
					PylonIncludes.h 
					PylonImage.h 
					PylonUtility.h 
					GenICamVersion.h
					PATHS
					"C:/Program Files/Basler/pylon 4/pylon/include"
					"C:/Program FilesBasler/pylon 4/pylon/include/pylon"
					"D:/Program Files/Basler/pylon 4/pylon/include"
					"D:/Program Files/Basler/pylon 4/pylon/include/pylon"
					"D:/Program Files/Basler/pylon 4/pylonc/include"
					"D:/Program Files/Basler/pylon 4/genicam/library/cpp/include"
					"D:/Program Files/Basler/pylon 4/pylonc/include/genapic"
					"D:/Program Files/Basler/pylon 4/pylonc/include/pylonc"
)


# ### NEXT TIME: apply for to search each library and get the list of all libraries beforehand
set( PYLON_LIB_NAMES	PylonGigE_MD_VC100_TL PylonBase_MD_VC100 
												Pylon1394_MD_VC100_TL 
												PylonGUI_MD_VC100
												PylonUtility_MD_VC100
												PylonBootstrapper
												MathParser_MD_VC100_v2_3
												GCBase_MD_VC100_v2_3
												GenApi_MD_VC100_v2_3
												Log_MD_VC100_v2_3
												Log4cpp_MD_VC100_v2_3
)

set(PYLON_SEARCH_LIB_DIRS	"D:/Program Files/Basler/pylon 4/pylon/lib/Win32"   # for WIN 32
															"C:/Program Files/Basler/pylon 4/pylon/lib/Win32"   # for WIN 32
															"D:/Program Files/Basler/pylon 4/genicam/library/cpp/lib/win32_i86"
															"D:/Program Files/Basler/pylon 4/pylonc/lib/Win32"
)
				

FOREACH (LIB_NAME ${PYLON_LIB_NAMES})

		find_library(${LIB_NAME}_LIB	${LIB_NAME} PATHS ${PYLON_SEARCH_LIB_DIRS})
		
		MESSAGE("Lib: ${LIB_NAME}")
		MESSAGE("Found Lib: ${${LIB_NAME}_LIB}")
		
		SET(ALL_FOUND_LIBS ${ALL_FOUND_LIBS} ${${LIB_NAME}_LIB})
		
		#MESSAGE("${ALL_FOUND_LIBS}")

ENDFOREACH (LIB_NAME)



IF(ALL_FOUND_LIBS AND PYLON_INCLUDE_DIR)
	
	SET(PYLON_INCLUDE_DIRS ${PYLON_INCLUDE_DIR}
															"D:/Program Files/Basler/pylon 4/pylon/include"
															"D:/Program Files/Basler/pylon 4/genicam/library/cpp/include"
															"D:/Program FilesBasler/pylon 4/pylonc/include"
										)
	
	# ### NEXT TIME: use append to add list of all found libraries e.g. refer to OpenCV CMake module
	SET(PYLON_LIBRARIES ${ALL_FOUND_LIBS})
	
	SET(PYLON_FOUND TRUE)
	
ENDIF()


IF(UNIX)

	message("this is Unix!")

ELSE(UNIX)

	IF (MSVC90)
		message("this is vc9!")
	
	ELSE (MSVC90)
	
	    IF (MSVC10)
			message("this is vc10!")
		ENDIF (MSVC10)
	
	ENDIF(MSVC90)

ENDIF(UNIX)



